<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html class="no-js">
	<head>
	    <meta http-equiv="Content-Type" charset="text/html; charset=utf-8" /> 
	    <meta http-equiv="expires" content="0" />
	    <meta http-equiv="pragma" content="no-cache" />
	    <meta http-equiv="Cache-Control" content="max-age=0" />
	    <meta http-equiv="Cache-Control" content="no-cache" />
	    <title><decorator:title default="管理控制台"></decorator:title></title>
	    <link rel="stylesheet" href="${staticUrl}/css/bootstrap-2.3.css">
	    <link rel="stylesheet" href="${staticUrl}/css/bootstrap-responsive.css">
		<link rel="stylesheet" href="${staticUrl}/css/font-awesome.css">
		<link rel="stylesheet" href="${staticUrl}/css/jump/jump.css">
		<link rel="stylesheet" href="${staticUrl}/css/jump/dashboard.css">
	    
	    <script type="text/javascript" src="${staticUrl}/js/libs/query/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/libs/bootstrap/js/bootstrap.min.js"></script>	
		<script type="text/javascript" src="${staticUrl}/js/pages/jump/Theme.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/pages/jump/Charts.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/plugins/excanvas.min.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/plugins/flot/jquery.flot.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/plugins/flot/jquery.flot.pie.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/plugins/flot/jquery.flot.orderBars.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/plugins/flot/jquery.flot.tooltip.min.js"></script>
		<script type="text/javascript" src="${staticUrl}/js/plugins/flot/jquery.flot.resize.js"></script>
		<decorator:head></decorator:head>
		<script type="text/javascript">
			var CONTEXTPATH ="${staticUrl}";
		</script>
	</head>
	<body>
		<div id="wrapper">
	
			<div id="topbar">
				<div class="container">
					<a href="javascript:;" id="menu-trigger" class="dropdown-toggle" data-toggle="dropdown" data-target="#">
						<i class="icon-cog"></i>
					</a>
					<div id="top-nav">
						<ul>
							<li class="dropdown">
							</li>
						</ul>
						<ul class="pull-right">
							<li><a href="javascript:;"><span class="badge badge-primary">1</span> 新消息</a></li>
							<li class="dropdown">
								<a href="./pages/settings.html" class="dropdown-toggle" data-toggle="dropdown">
									设置						
									<b class="caret"></b>
								</a>
								<ul class="dropdown-menu pull-right">
									<li><a href="javascript:;">锁定</a></li>
									<li><a href="javascript:;">修改密码</a></li>
									<!-- 
									<li class="dropdown-submenu">
					                  <a tabindex="-1" href="#">下拉菜单</a>
					                  <ul class="dropdown-menu">
					                    <li><a tabindex="-1" href="#">菜单1</a></li>
					                    <li><a tabindex="-1" href="#">菜单2</a></li>
					                    <li><a tabindex="-1" href="#">菜单3</a></li>
					                  </ul>
					                </li> -->
								</ul> 
							</li>
							<li><a href="${staticUrl}/login/exit">退出</a></li>
						</ul>
					</div> <!-- /#top-nav -->
				</div> <!-- /.container -->
			</div> <!-- /#topbar -->
			<div id="header">
				
				<div class="container">
					<a href="${staticUrl}/frame/jump" class="brand">首页</a>
					<a href="javascript:;" class="btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
			        	<i class="icon-reorder"></i>
			      	</a>
					<div class="nav-collapse">
						<ul id="main-nav" class="nav pull-right">
							<li class="nav-icon active">
								<a href="${staticUrl}/frame/jump">
									<i class="icon-home"></i>
									<span>首页</span>        					
								</a>
							</li>
							<!-- 
							<li class="dropdown">					
								<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
									<i class="icon-th"></i>
									<span>组件</span> 
									<b class="caret"></b>
								</a>	
							
								<ul class="dropdown-menu">
									<li><a href="./elements.html">组件</a></li>
									<li><a href="./validation.html">表单验证</a></li>
									<li><a href="./jqueryui.html">jQuery UI</a></li>
									<li><a href="./charts.html">图表</a></li>
									<li><a href="./bonus.html">其他组件</a></li>
									<li class="dropdown-submenu">
					                  <a tabindex="-1" href="#">下拉菜单</a>
					                  <ul class="dropdown-menu">
					                    <li><a tabindex="-1" href="#">菜单1</a></li>
					                    <li><a tabindex="-1" href="#">菜单2</a></li>
					                    <li><a tabindex="-1" href="#">菜单3</a></li>
					                  </ul>
					                </li>
								</ul>    				
							</li>
							
							<li class="dropdown">					
								<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
									<i class="icon-copy"></i>
									<span>简单页面</span> 
									<b class="caret"></b>
								</a>	
							
								<ul class="dropdown-menu">
									<li><a href="./faq.html">帮助</a></li>
									<li><a href="./gallery.html">相册效果</a></li>
									<li><a href="./pricing.html">价格单</a></li>
									<li><a href="./reports.html">报表</a></li>
									<li><a href="./settings.html">设置</a></li>
								</ul>    				
							</li>
							
							<li class="dropdown">					
								<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
									<i class="icon-external-link"></i>
									<span>其他</span> 
									<b class="caret"></b>
								</a>	
							
								<ul class="dropdown-menu">							
									<li><a href="./login.html">登录</a></li>
									<li><a href="./signup.html">注册</a></li>
									<li><a href="./error.html">错误</a></li>
									<li><a href="./skins.html">主题</a></li>
									<li><a href="./sticky.html">完美的底部</a></li>
								</ul>    				
							</li>
							<li class="dropdown">					
								<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
									<i class="icon-external-link"></i>
									<span>测试</span> 
									<b class="caret"></b>
								</a>	
							
								<ul class="dropdown-menu">							
									<li><a href="./login.html">登录</a></li>
									<li><a href="./signup.html">注册</a></li>
									<li><a href="./error.html">错误</a></li>
									<li><a href="./skins.html">主题</a></li>
									<li><a href="./sticky.html">完美的底部</a></li>
								</ul>    				
							</li>
						 -->
						</ul>
					</div> <!-- /.nav-collapse -->
				</div> <!-- /.container -->
			</div> <!-- /#header -->
			
			<div id="masthead">
				<div class="container">
					<div class="masthead-pad">
						<div class="masthead-text">
						</div> <!-- /.masthead-text -->
					</div>
				</div> <!-- /.container -->	
			</div> <!-- /#masthead -->
			<div id="content">
				 
					<decorator:body/>
				
			</div>
		</div> <!-- /#wrapper -->
		
		<div id="footer">
			<div class="container">
				<div class="row">
					<div class="span6">
						© 2014 all rights reserved.
					</div> <!-- /span6 -->
					<div id="builtby" class="span6">
						<a href="#">Built by XY</a>				
					</div> <!-- /.span6 -->
				</div> <!-- /row -->
			</div> <!-- /container -->
		</div> <!-- /#footer -->
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
                    </div>
                    <div class="modal-body">
                        ...
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary">Save changes</button>
                    </div>
                </div>
            </div>
        </div>
		<script type="text/javascript">
			function createMenu(element){ 
				var menuli = $("<li class='dropdown'></li>");
				//child
				menuli.append("<a href='javascript:;' class='dropdown-toggle' data-toggle='dropdown'><i class='icon-"+element.F_MENU_ICON+"'></i><span>"+
						element.F_MENU_TITLE
				+"</span><b class='caret'></b></a>");
				if(element.child){
					var menuUI = $("<ul class='dropdown-menu'></ul>");
					for(var i=0;i<element.child.length;i++){
					 	var element2 = element.child[i];
					 	if(element2.child && element2.child.length > 0){
					 		var  nextLI = $("<li class='dropdown-submenu'></li>");
					 		nextLI.append("<a tabindex='-1' href='#'>"+element2.F_MENU_TITLE+"</a>");
					 		var subUL = $("<ul class='dropdown-menu'></ul>");
			                for(var j=0;j<element2.child.length;j++){
			                	  var element3 = element2.child[j];
			                	  subUL.append("<li><a tabindex='-1' href='"+CONTEXTPATH+element3.F_MENU_COMMAND+"'>"+element3.F_MENU_TITLE+"</a></li>")
			                }
			                nextLI.append(subUL);
			                menuUI.append(nextLI);
					 	}  else {
							//添加菜单
					 		menuUI.append("<li><a href='"+CONTEXTPATH+element2.F_MENU_COMMAND+"'>"+element2.F_MENU_TITLE+"</a></li>");
					 	}
					}
					menuli.append(menuUI);
				}
				return menuli;
			}
			$(document).ready(function(){
				var urlgetUserMenu = CONTEXTPATH+"/frame/getUserMenu";
				$.getJSON(urlgetUserMenu, function(json){
					  for(var i=0;i<json.obj.length;i++){
						 	var element = json.obj[i];
							//添加菜单
							$("#main-nav").append(createMenu(element));
						}
					});
			});
		</script>
	</body>
	
</html>